from django.db import models

class Realt(models.Model):
    postingDate = models.DateTimeField()
    title = models.CharField(max_length=100)
    textArticle = models.TextField(default="")
    totalArea = models.FloatField(default=0)
    moreContact = models.TextField(blank=True)
    price = models.FloatField()
    commercial = models.BooleanField(default=False)
    address = models.CharField(max_length=200)

#    def __unicode__(self):
#        return self.title

    class Meta:
        abstract = True

class Material(models.Model):
    type = models.CharField(max_length=100)

    def __unicode__(self):
        return self.type


class Building(Realt):
    area = models.FloatField()
    numberRooms = models.IntegerField(default=1)
    kitchenNumber = models.IntegerField(default=1)
    material = models.OneToOneField(Material)
    BTYPE = (
        (0, 'Apartment'),
        (1, 'House'),
    )
    buildingType = models.IntegerField(choices=BTYPE)
    flor = models.IntegerField(default=1)


class WC(models.Model):
    building = models.ForeignKey(Building)
    WCTYPE = (
        (0, 'separated'),
        (1, 'outdoors'),
        (2, 'combined'),
        (3, 'unknown'),
    )
    type = models.IntegerField(choices=WCTYPE)




